import Promise from 'es6-promise';
import Vue from 'vue'
import App from './App'
// import {update} from "./assets/js/update"
//import store from './store'
//import configData from "./page/js/config_data"
import vView from 'vue-view-lazy'
//饿了么UI
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import {database} from './assets/api/common'

Promise.polyfill();

// import router from './router'
Vue.use(vView)


Vue.use(ElementUI)

//if (!process.env.IS_WEB) Vue.use(require('vue-electron'))
Vue.config.productionTip = false
// Vue.prototype.$electron = window.require("electron")

/**
 * 事件总线
 * @type {Vue | CombinedVueInstance<Vue, object, object, object, Record<never, any>>}
 */
window.$EventBus = Vue.prototype.$EventBus = new Vue({
    data: function () {
        return {
            dataLimit: 500,
        }
    },
    watch: {
        dataLimit: function (cur) {
            if(cur == "") return;
            database({type: "insert", key: "dataLimit", tree_name: "config", value: cur});
        }
    }

}); //事件总线

database({type: "select", key: "dataLimit", tree_name: "config"}).then(data => {
    console.log("database dataLimit", data);
    if(data != null) {
        window.$EventBus.dataLimit = data;
    }
})



//Vue.prototype.$store = store
//Vue.prototype.$configData = configData

window.staticPath = "";

/* eslint-disable no-new */
new Vue({
    // router,
    render: h => h(App),
    //store,
    //template: '<App/>',
    mounted() {
        //update(this);
    },
}).$mount('#app')
